package com.alm.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * @author ywy
 * @date 2024/6/25
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum OnlineStatusEnum {
    /**
     * 在线
     */
    ONLINE(1, "在线"),
    /**
     * 离线
     */
    OFFLINE(0, "离线");


    private Integer code;

    private String value;

    public static String getByCode(Integer code) {
        for(OnlineStatusEnum statusEnum : OnlineStatusEnum.values()) {
            if(code.equals(statusEnum.getCode())) {
                return statusEnum.value;
            }
        }
        return "";
    }
}
